var mainh=null;

function goToLoginPage(){
  hideMainAFooter();
  var header=""
    +"<header id='mainheaderRegs' style='background:transparent;border:0;' >"
    +  "<a class='backButton left' ref='#login'>"
    +  "<img src='./img/first/returnlb.png' class='returnlbc' />"
    +  "</a>"
    +"</header>";
  $("#login").prepend(header);
  $("#mainheaderRegs").bind("click",function(){
    removeMainheaderRegs();
    showMainAFooter();
  });
}

function goToRegsPage(){
  removeMainheaderRegs();
  var header=""
    +"<header id='mainheaderRegs' style='background:black;'>"
    +  "<a class='backButton left' ref='#login'>"
    +  "<img src='./img/first/returnlb.png' class='returnlbc' />"
    +  "</a>"
    +  "<h1 class='labelp'>注册</h1>"
    +"</header>";
  $("#mainview").prepend(header);
  $("#mainheaderRegs").bind("click",function(){
    removeMainheaderRegs();
    goToLoginPage();
  });

}

/** for register page go to register personal panel
    this function removes the header created by register page and
    creater owner header
*/
function goToRegsPerPage(){
  removeMainheaderRegs();
  var header=""
    +"<header id='mainheaderRegs' style='background:black;' >"
    +  "<a class='backButton left' ref='#regs'>"
    +  "<img src='./img/first/returnlb.png' class='returnlbc'/>"
    +  "</a>"
    +  "<h1 class='labelp'>个人信息</h1>"
    +  "<div class='ingoreButton' id='ingoreDiv'>跳过</div>"
    +"</header>";
  $("#mainview").prepend(header);
  $("#mainheaderRegs").bind("click",function(){
    removeMainheaderRegs();
    goToRegsPage();
  });

  $("#ingoreDiv").bind("click",function(){
    $("#ingoreButton").click();
  });
}

/** for register personal page go to parking page*/
function goToParking(){
  removeMainheaderRegs();
  showMainAFooter();
}

/** go to comfirm order page **/
function goToComfirmOrder(){
  //window.location.hash='#comfirmparking';
  //$("#comfirmparking").addClass("active");
  hideMainAFooter();
  var header=""
    +"<header id='mainheaderRegs' style='background:black;' >"
    +  "<a class='backButton left' id='leftb' ref='#main'>"
    + "<img src='./img/first/returnlb.png' class='returnlbc'/>"
    +  "</a>"
    +  "<h1 class='labelp'>支付订单</h1>"
    +"</header>";
  $("#mainview").prepend(header);
  $("#leftb").bind("click",function(){
    removeMainheaderRegs();
    showMainAFooter();
  });
  /*
  setTimeout(function(){
    $("#comfirmparking").addClass("active");
  },510);
  */
  //$.afui.loadContent("#comfirmparking",false,false,"up");
}

function goToComfirmPayPage(){
  removeMainheaderRegs();
  var header=""
    +"<header id='mainheaderRegs' style='background:black;' >"
    +  "<h1 class='labelp'>交易详情</h1>"
    +"</header>";
  $("#mainview").prepend(header);
  $("#comCost").html("￥"+$("#totalFee").val());
}

function comPayGoBackMain(){
  removeMainheaderRegs();
  showMainAFooter();
  resetAll();
}

function removeMainheaderRegs(){
  $("#mainheaderRegs").remove();
}
